<%--
  Created by IntelliJ IDEA.
  User: Onlyevan
  Date: 2017/9/16
  Time: 12:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
<head>
    <title>listProduct</title>
</head>
<body>
    <h2 align="center">
        当前产品分类为：${category.name}
        <a href="listCategory">返回产品目录</a>
    </h2>
    <table align="center" border="1" cellspacing="0" width="25%">
        <tr>
            <td>id</td>
            <td>名字</td>
            <td>价格</td>
            <td>修改</td>
            <td>删除</td>
        </tr>
        <c:forEach items="${listProducts}" var="product">
            <tr>
                <td>${product.id}</td>
                <td>${product.name}</td>
                <td>${product.price}</td>
                <td></td>
                <td></td>
            </tr>
        </c:forEach>
    </table>
    <div align="center" style="margin-top: 20px">
        <a href="?id=${category.id}&start=0">首页</a>
        <a href="?id=${category.id}&start=${(pageSite.start - pageSite.count) < 0 ? 0 : pageSite.start - pageSite.count}">上一页</a>
        <c:forEach varStatus="num" items="${yeshu}">
            <a href="?id=${category.id}&start=${ (num.count - 1) * pageSite.count}">${num.count}</a>
        </c:forEach>
        <a href="?id=${category.id}&start=${(pageSite.start + pageSite.count) >= pageSite.end + pageSite.count ? pageSite.end : pageSite.start + pageSite.count}">下一页</a>
        <a href="?id=${category.id}&start=${pageSite.end}">尾页</a>
    </div>


</body>
</html>
